﻿using System;
using Microsoft.VisualStudio.Debugger.Interop;
using Red.Scripts.Debugger.Defines;

namespace Red.Scripts.Debugger.Engine
{
    internal class AD7Program : IDebugProgram2
    {
        private readonly Guid _guid;

        public Events.Postman Postman { get; set; }

        public AD7Program( Guid guid )
        {
            _guid = guid;
        }

        public int CanDetach()
        {
            return Constants.S_OK;
        }

        public int CauseBreak()
        {
            return Constants.S_OK;
        }

        public int Continue( IDebugThread2 pThread )
        {
            return Constants.S_OK;
        }

        public int Detach()
        {
            Postman.SendProgramDestroyedEvent( this );

            return Constants.S_OK;
        }

        public int EnumCodeContexts( IDebugDocumentPosition2 pDocPos, out IEnumDebugCodeContexts2 ppEnum )
        {
            throw new NotImplementedException();
        }

        public int EnumCodePaths( string pszHint, IDebugCodeContext2 pStart, IDebugStackFrame2 pFrame, int fSource, out IEnumCodePaths2 ppEnum, out IDebugCodeContext2 ppSafety )
        {
            throw new NotImplementedException();
        }

        public int EnumModules( out IEnumDebugModules2 ppEnum )
        {
            throw new NotImplementedException();
        }

        public int EnumThreads( out IEnumDebugThreads2 ppEnum )
        {
            throw new NotImplementedException();
        }

        public int GetDebugProperty( out IDebugProperty2 ppProperty )
        {
            throw new NotImplementedException();
        }

        public int GetDisassemblyStream( enum_DISASSEMBLY_STREAM_SCOPE dwScope, IDebugCodeContext2 pCodeContext, out IDebugDisassemblyStream2 ppDisassemblyStream )
        {
            throw new NotImplementedException();
        }

        public int GetENCUpdate( out object ppUpdate )
        {
            throw new NotImplementedException();
        }

        public int GetEngineInfo( out string pbstrEngine, out Guid pguidEngine )
        {
            pbstrEngine = null;
            pguidEngine = Defines.Id.Guid.Engine;

            return Constants.S_OK;
        }

        public int GetMemoryBytes( out IDebugMemoryBytes2 ppMemoryBytes )
        {
            throw new NotImplementedException();
        }

        public int GetName( out string pbstrName )
        {
            pbstrName = null;

            return Constants.S_OK;
        }

        public int GetProgramId( out Guid pguidProgramId )
        {
            pguidProgramId = _guid;

            return Constants.S_OK;
        }

        public int Step( IDebugThread2 pThread, enum_STEPKIND sk, enum_STEPUNIT Step )
        {
            throw new NotImplementedException();
        }

        public int Terminate()
        {
            throw new NotImplementedException();
        }

        public int WriteDump( enum_DUMPTYPE DUMPTYPE, string pszDumpUrl )
        {
            throw new NotImplementedException();
        }

        #region Deprecated - Not called by the debugger

        public int Attach( IDebugEventCallback2 pCallback )
        {
            throw new NotImplementedException();
        }

        public int GetProcess( out IDebugProcess2 ppProcess )
        {
            throw new NotImplementedException();
        }

        public int Execute()
        {
            throw new NotImplementedException();
        }

        #endregion Deprecated - Not called by the debugger
    }
}
